<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:U('discount_list')}">优惠信息列表</a></li>
        <li class="active"><a>优惠信息添加</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form" action="{:U('Operation/discount_add')}" method="post">
        <fieldset>
            <div class="control-group">
                <label class="control-label">城市:</label>
                <div class="controls">
                    <select onchange="CityChanged();" id="city">
                        <option value="">==请选择省==</option>
                        <volist name="province_data" id="vo">
                            <option value="{$vo.id}">{$vo.name}</option>
                        </volist>
                    </select>
                    <select name="cityid" id="cityid">

                    </select>
                        *
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">标题:</label>
                <div class="controls">
                    <input class="" name="title" type="text" placeholder="" /> *
                   </div>
            </div>
            <div class="control-group">
                <label class="control-label">优惠简介:</label>
                <div class="controls">
                    <textarea name="intro" cols="20" rows="5"></textarea> *
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">优惠内容:</label>
                <div class="controls">
                    <textarea name="content" id="content" cols="20" rows="30" style="height: 400px"></textarea> *
                </div>
            </div>

        </fieldset>
        <div class="form-actions">
            <button type="submit" class="btn btn-primary  js-ajax-submit">{:L('SAVE')}</button>
            <a class="btn" href="{:U('discount_list')}">{:L('BACK')}</a>
        </div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.DIMAUB;
</script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    var editorcontent = new baidu.editor.ui.Editor();
    editorcontent.render('content');
</script>
<script>
    function CityChanged(province_id){

        $.ajax({
            url:"{:U('Operation/location_api')}",
            data:"province_id="+$("#city").val(),
            dataType:"JSON",
            success:function(ret){
                cmbAddOption(ret.retValue);
            }
        });
    }

    function cmbAddOption(ret)
    {
        $("#cityid").empty();
        var opetion = null;
        for(var i =0; i<ret.length;i++){
            opetion+= '<option value="'+ret[i].id+'">'+ret[i].city+'</option>';
        }
        $("#cityid").append(opetion);
    }



</script>
</body>
</html>